<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:ui="http://java.sun.com/jsf/facelets">
<f:view contentType="text/html" locale="en">
<h:head/>
<h:body>
<div class="wrap container">
<ui:include src="/views/blocks/header.xhtml"/>
<f:metadata>
	<f:event listener="#{profileBean.init}" type="preRenderView"></f:event>
</f:metadata>
	<p:panel id="user_info" header="Account information">
		<h:form>
		 <p:growl id="message" showDetail="true" />
	     <p:panelGrid id="information" columns="3" >
		        
		        <h:outputText value="User name:"/>
		        <h:outputText id="username" value="#{profileBean.authUser.username}"/>
		        <p:message for="username"/>
		        																																																																																																																				
		        <h:outputText value="Full name:*"/>
		        <p:inputText id="fullName" required="true" value="#{profileBean.authUser.fullName}" label="FullName"/>
		        <p:message for="fullName"/>	
		        
		        <h:outputText value="Email:*"/>
		        <p:inputText id="email" required="true" value="#{profileBean.authUser.email}"  label="Email"/>
		        <p:message for="email"/>
		
		        <h:outputText id="notes" value="Notes:"/>
		        <p:inputTextarea required="false" value="#{profileBean.authUser.notes}"/>
		        <p:message for="notes"/> 
		        
		        <h:outputText value="Password:*"/>
		        <p:password id="pwd1" label="Password" required="true" value="#{profileBean.confirmPassword}"
		        	validator="#{profileBean.isPasswordCorrect}"/>
		        <p:message for="pwd1"/>       
		        
		        <p:commandButton id="edit" value="Edit" ajax="false" validateClient="true" action="#{profileBean.edit}"/>
		        <p:commandButton  value="Delete"  update="message">
		                <p:confirm header="Confirmation" message="Delete your account?"/>
		        </p:commandButton>      
		        <p:message for="edit"/> 
		</p:panelGrid>
	                                
	    <p:confirmDialog global="true" showEffect="fade" hideEffect="explode">
	         <p:commandButton value="Yes" action="#{profileBean.deleteAccount}" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
	         <p:commandButton value="No" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
	     </p:confirmDialog>
	</h:form>
	</p:panel>
</div>
</h:body>
</f:view>
</html>